<!DOCTYPE html>
<html lang="zh-CN">
<head>
    //@ include("/inc/head.html"){}
    <title>资源列表</title>

    <script>
        function del(id) {
            swal({
                    title: "您确定要删除当前资源？",
                    text: "删除后无法恢复，请确认后删除！",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "删除",
                    cancelButtonText: "保留",
                    closeOnConfirm: false,
                    closeOnCancel: false,
                    showLoaderOnConfirm: true
                },
                function (isConfirm) {
                    if (isConfirm) {
                        location.href = '${ctxPath}/shiro/resource/delete/' + id;
                        swal("提示", "删除成功！", "success");
                    } else {
                        swal("提示", "资源未被删除！", "info");
                    }
                });
        }
    </script>
</head>
<body>

//@ include("/shiro/top.html"){}

<div class="container-fluid">
    <ol class="breadcrumb">
        <li><a href="${ctxPath}/shiro/main">权限管理</a></li>
        <li class="active">资源管理</li>
    </ol>

    <div class="table-responsive">
        <table data-toggle="table">
            <thead>
            <tr>
                <th data-visible="false">ID</th>
                <th>名称</th>
                <th>路径</th>
                <th>许可编码</th>
                <th>描述</th>
                <th>顺序</th>
                <th>是否在菜单中显示</th>
                <th>创建时间</th>
                <th>最后修改时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            //@ for(resource in resources){
            <tr>
                <td>${resource.id}</td>
                <td>
                    //@ var i=resource.levels;while(i-->0){print('　');}
                    ${resource.name}
                </td>
                <td>${resource.url}</td>
                <td>${resource.permission}</td>
                <td>${resource.remark}</td>
                <td>${resource.seq}</td>
                <td>${resource.visible==1?'显示':'不显示'}</td>
                <td>${resource.created,dateFormat='yyyy-MM-dd HH:mm:ss'}</td>
                <td>${resource.modified,dateFormat='yyyy-MM-dd HH:mm:ss'}</td>
                <td>
                    //@ if(shiro.hasPermission("shiro:resource:update")){
                    <button class="btn btn-warning"
                            onclick="location.href='${ctxPath}/shiro/resource/update/${resource.id}'">编辑
                    </button>
                    //@ }
                    //@ if(shiro.hasPermission("shiro:resource:delete")){
                    <button class="btn btn-danger" onclick="del('${resource.id}');">删除</button>
                    //@ }
                </td>
            </tr>
            //@ }
            </tbody>
        </table>
    </div>

</div>
</body>
</html>